package org.gwt.pluginframework.desktop.client;

import org.gwt.pluginframework.common.Plugin;
import org.gwt.pluginframework.plugin.PerspectiveNorthExtension;

import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class TopBar extends VerticalPanel implements PerspectiveNorthExtension {

	private static final long serialVersionUID = 5763749962527596730L;

	private static final String TOP_BAR_NAME = "topBar";

	private boolean initialized = false;

	protected Plugin plugin;
	
	public Widget getWidget() {
		if(!initialized) {
			Label title = new Label("Plugin Desktop Application Example - gwt-plugin-framework");
			title.setStylePrimaryName("title");
			add(title);
			Label version = new Label("version 0.1");
			version.setStylePrimaryName("version");
			add(version);
			initialized = true;
		}
		return this;
	}

	public String getName() {
		return TOP_BAR_NAME;
	}
	
	public void setParent(Plugin plugin) {
		this.plugin = plugin;
	}
	
	public Plugin getPlugin() {
		return plugin;
	}
}
